package com.finalx.TrafficBytes;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class MyReceiver extends BroadcastReceiver {
	private String TAG = "TrafficBytes";

	@Override
	public void onReceive(Context arg0, Intent arg1) {
		
		String receivedAct = arg1.getAction();
		
		if (receivedAct.equals(Intent.ACTION_BOOT_COMPLETED)) {
			Log.d(TAG, "@@boot completed broadcast received");
			startTrafficWatchService(arg0);
            
		}
	}
	
	private void startTrafficWatchService(Context context) {
		Intent bootActivityIntent=new Intent(context, TrafficWatcherService.class);
        bootActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);    
        context.startService(bootActivityIntent);  
	}

}
